package com.xyht.medicine_management_system.modules.payment.alipay.config;

import cn.hutool.core.io.FileUtil;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.msg.AlipayMsgClient;
import com.alipay.api.msg.MsgHandler;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import static com.xyht.medicine_management_system.modules.payment.constant.CommonConstant.*;


@Component
public class AlipayInitConfig {
    public static AlipayConfig alipayConfig;

    /**
     * @description 支付宝支付初始化配置

     * @create 2023/12/24
     * @author dxn
    */
    @Bean
    public void alipayInit(){
        alipayConfig = new AlipayConfig();
        alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
        alipayConfig.setAppId(ALIPAY_APPID);
        alipayConfig.setPrivateKey(ALIPAY_PRIVATE_KEY);
        alipayConfig.setFormat("json");
        alipayConfig.setAlipayPublicKey(ALIPAY_PUBLIC_KEY);
        alipayConfig.setCharset("UTF-8");
        alipayConfig.setSignType("RSA2");
    }

}
